package com.eshop.modules.product.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.NotNull;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.baomidou.mybatisplus.annotation.TableField;
import com.alibaba.fastjson.JSONArray;
import javax.validation.constraints.NotBlank;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.eshop.domain.BaseDomain;

@TableName(value = "store_product_rule", autoResultMap = true)
public class StoreProductRule extends BaseDomain
{
    @TableId
    private Integer id;
    @NotBlank(message = "请输入规则名称")
    private String ruleName;
    @TableField(typeHandler = FastjsonTypeHandler.class)
    @NotNull(message = "规格名称/值必填")
    private JSONArray ruleValue;
    
    public void copy(final StoreProductRule source) {
        BeanUtil.copyProperties((Object)source, (Object)this, CopyOptions.create().setIgnoreNullValue(true));
    }
    
    public Integer getId() {
        return this.id;
    }
    
    public String getRuleName() {
        return this.ruleName;
    }
    
    public JSONArray getRuleValue() {
        return this.ruleValue;
    }
    
    public void setId(final Integer id) {
        this.id = id;
    }
    
    public void setRuleName(final String ruleName) {
        this.ruleName = ruleName;
    }
    
    public void setRuleValue(final JSONArray ruleValue) {
        this.ruleValue = ruleValue;
    }
    
    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        }
        if (!(o instanceof StoreProductRule)) {
            return false;
        }
        final StoreProductRule other = (StoreProductRule)o;
        if (!other.canEqual(this)) {
            return false;
        }
        final Object this$id = this.getId();
        final Object other$id = other.getId();
        Label_0065: {
            if (this$id == null) {
                if (other$id == null) {
                    break Label_0065;
                }
            }
            else if (this$id.equals(other$id)) {
                break Label_0065;
            }
            return false;
        }
        final Object this$ruleName = this.getRuleName();
        final Object other$ruleName = other.getRuleName();
        Label_0102: {
            if (this$ruleName == null) {
                if (other$ruleName == null) {
                    break Label_0102;
                }
            }
            else if (this$ruleName.equals(other$ruleName)) {
                break Label_0102;
            }
            return false;
        }
        final Object this$ruleValue = this.getRuleValue();
        final Object other$ruleValue = other.getRuleValue();
        if (this$ruleValue == null) {
            if (other$ruleValue == null) {
                return true;
            }
        }
        else if (this$ruleValue.equals(other$ruleValue)) {
            return true;
        }
        return false;
    }
    
    protected boolean canEqual(final Object other) {
        return other instanceof StoreProductRule;
    }
    
    public int hashCode() {
        final int PRIME = 59;
        int result = 1;
        final Object $id = this.getId();
        result = result * 59 + (($id == null) ? 43 : $id.hashCode());
        final Object $ruleName = this.getRuleName();
        result = result * 59 + (($ruleName == null) ? 43 : $ruleName.hashCode());
        final Object $ruleValue = this.getRuleValue();
        result = result * 59 + (($ruleValue == null) ? 43 : $ruleValue.hashCode());
        return result;
    }
    
    public String toString() {
        return "StoreProductRule(id=" + this.getId() + ", ruleName=" + this.getRuleName() + ", ruleValue=" + this.getRuleValue() + ")";
    }
}
